package com.liwei.controller;
import com.liwei.dto.ResultDTO;
import com.liwei.exception.MyLengthException;
import com.liwei.services.DemoServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/")
public class IndexController {
    @Autowired
    DemoServices demoServices;

    @RequestMapping("add.action")
    public ResultDTO add(float opt1,float opt2) throws MyLengthException {
        ResultDTO resultDTO = new ResultDTO();
        resultDTO.setResult(resultDTO.SUCCESS);
        float add = demoServices.add(opt1, opt2);
        resultDTO.setData(add);
        return resultDTO;
    }
}
